data(instacart)
instacart_df = 
  instacart |> 
  select(
    order_id, product_id, order_number, order_hour_of_day, product_name, aisle, department, department_id
  )

Column

Total Number of Items of Each Department

instacart_df |> 
  group_by(department) |> 
  plot_ly(x = ~department, y = ~order_hour_of_day, color = ~department,
          type = "box", colors = "viridis")

Column

Distribution of Order Hour of Day for Each Department

instacart_df |> 
  group_by(department_id, department) |>
  summarize(n_items = n()) |> 
  mutate(
    department = as.factor(department),
    text_label = str_c("Department ID: ", department_id)
    ) |> 
  plot_ly(y =~n_items, x=~reorder(department, +n_items), text =~text_label,
          type = "scatter", mode = "markers", alpha = .5)
## `summarise()` has grouped output by 'department_id'. You can override using the
## `.groups` argument.

Fluctuation of Number of Orders Among the Day

instacart_df |> 
  group_by(order_hour_of_day)|> 
  summarise(n_order = n_distinct(order_id))|> 
  plot_ly(x = ~order_hour_of_day, y = ~n_order, type = 'scatter', mode = 'lines')